package com.guoxin.part1.chapter1;

/**
 * @author guoxin
 * @date 2019/8/26
 */
public class TicketWindow extends Thread {
    private static final int MAX=50;

    private static int index=1;
    public TicketWindow(String name){
        setName(name);
    }

    @Override
    public void run() {
        while(index<=MAX){
            System.out.println("柜台："+Thread.currentThread().getName()+" 当前号码是："+index++);
        }
    }

    public static void main(String[] args) {
        TicketWindow t1 = new TicketWindow("一");
        t1.start();
        TicketWindow t2 = new TicketWindow("二");
        t2.start();
        TicketWindow t3 = new TicketWindow("三");
        t3.start();
        TicketWindow t4 = new TicketWindow("四");
        t4.start();
    }
}
